package game;

import java.awt.Point;
import java.util.*;

/**
 * <p>This class represents a {@code Knight} from a game of chess.</p>
 * 
 * @author Nicole Waldrum
 * @date January 30, 2010
 * @version 1.0
 *
 * @author Mark Kelly
 * @date February 19, 2010
 * @version 2.0
 * 
 * @author Trevor Bastian
 * @date February 20, 2010
 * @version 2.0
 */
public class Knight extends Piece {
	private static final String DEFAULT_LETER = "N";
	
	/**
	 * <p>Creates a new instance of {@code Knight}</p>
	 * 
	 * @param name the name of this {@code Knight}
	 * @param position the initial position of this {@code Knight}
	 * @param team the {@code Team} that this {@code Knight} is on
	 */
	public Knight(String name, Point position, Team team) {
		super(name, position, team);
	}
	
	/**
	 * <p>Creates a new instance of {@code Knight}</p>
	 * 
	 * @param position the initial position of the {@code Knight}
	 * @param team the {@code Team} that the {@code Knight} is on
	 */
	public Knight(Point position, Team team) {
		super(position, team);
	}

	/**
	 * {@inheritDoc}
	 */
	public String toLetter() {
		return DEFAULT_LETER;
	}
	
	/**
	 * {@inheritDoc}
	 */
	@Override
	public List<Point> checkMovePattern(Point dest) {
		List<Point> ret = new ArrayList<Point>();
		return ret;
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public boolean isValidMove(Piece piece, Point dest) {
		Point start = piece.getLocation();
		
		if (((int) Math . abs ( start.getX () - dest . getX ()) == 2 ) && ((int) Math . abs ( start . getY () - dest . getY ()) == 1))
			return super.isValidMove(piece, dest);
		if (((int) Math . abs ( start . getX () - dest . getX ()) == 1 ) && ((int) Math . abs ( start . getY () - dest . getY ()) == 2 ))
			return super.isValidMove(piece, dest);

		return false;
	}
}
